<?php
/*
	账户支付
	管理端支付接口
*/

defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['list']=array();
	$return['params']=array('groupid'=>0,'keyword'=>'');
	if($_RQ['keyword']){
		$return['params']['keyword']=$_RQ['keyword'];
	}
	$return['groups']=pdo_getall('jy_onlineedu_video_group',array('uniacid'=>$_SESSION['uniacid'],'status'=>'1'));
	$return['sharedata']=array(
		'title'=>'视频列表',
		'desc'=>$return['pluginset']['share_desc'],
		'link'=>custom_url('jy_kaoshi/videolist/',true),
		'imgUrl'=>tomedia($return['pluginset']['share_image']),
	);
	set_html('title',$item['title']);
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>'1');
	if($_RQ['groupid']){
		$params['groupid']=intval($_RQ['groupid']);
	}
	if($_RQ['groupid2']){
		$params['groupid2']=intval($_RQ['groupid2']);
	}
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
	//状态为显示的所有活动，排序
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_kaoshi_list',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($list){
		foreach($list as &$item){
			$item['videos']=json_decode($item['videos'],true);
			$item['video']=$item['videos'][0];
		}
	}
	$return['list']=$list;
	exi($return);
}